home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 19
/
Mac Magazin and MacEasy Magazine CD - Issue 19.iso
/
Grafik & Text & Film
/
Quark XTensions
/
Freeware Xtensions
/
Quark AppleScript Scripts
/
Scripts (text only)
/
Fit Box to Picture
< prev
next >
Wrap
Text File
|
1994-05-02
|
3KB
|
74 lines
--Copyright 1994 Quark, Inc. All rights reserved.
tell application "QuarkXPress™"
activate
if exists (document 1) then
tell document 1
if exists (current box) then
if (box type of current box ≠ picture box) then
display dialog "Please select a picture box before running this script." buttons {"Cancel"} default button 1 with icon stop
end if
set hm to horizontal measure
set vm to vertical measure
if hm ≠ points and vm ≠ points then
set properties to {horizontal measure:points, vertical measure:points}
end if
tell current box
set bnds to bounds of it as list
set bnds1 to item 1 of bnds as real
set bnds2 to item 2 of bnds as real
set boxrot to rotation as real
set boxskew to skew as real
if boxskew ≠ 0 or boxrot ≠ 0 then
display dialog "This script cannot process skewed and/or rotated picture boxes." buttons {"Cancel"} default button 1 with icon stop
end if
tell image 1
set grfkbnds to bounds
set grfkbnds3 to item 3 of grfkbnds as real
set grfkbnds4 to item 4 of grfkbnds as real
set grfkscle to scale as list
set grfkscle1 to (item 1 of grfkscle as real) / 100
set grfkscle2 to (item 2 of grfkscle as real) / 100
set grfkofst to offset as list
set grfkofst1 to item 1 of grfkofst as real
set grfkofst2 to item 2 of grfkofst as real
set rot to angle as real
set grfkskew to skew as real
if grfkbnds = {0, 0, 0, 0} then
display dialog "There is no picture in this picture box." buttons {"Cancel"} default button 1 with icon stop
end if
end tell
set var1 to (bnds1 + grfkofst1) as real
set var2 to (bnds2 + grfkofst2) as real
set var3 to (bnds1 + grfkofst1 + (grfkbnds4 * grfkscle1)) as real
set var4 to (bnds2 + grfkofst2 + (grfkbnds3 * grfkscle2)) as real
try
set properties to {bounds:{var1, var2, var3, var4}, rotation:rot, skew:grfkskew}
tell image 1
set properties to {offset:{0, 0}, angle:0, skew:0}
end tell
on error
set properties of document 1 to {horizontal measure:hm, vertical measure:vm}
display dialog "The item can't be positioned off the pasteboard." buttons "Cancel" default button 1 with icon stop
end try
end tell
if hm ≠ points and vm ≠ points then
set properties to {horizontal measure:hm, vertical measure:vm}
end if
else
display dialog "Please select a picture box before running this script." buttons {"OK"} default button 1 with icon note
end if
end tell
else
display dialog "Please open a QuarkXPress™ document before running this script." buttons "Cancel" default button 1 with icon stop
end if
end tell